/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1595402090733_1376';
  config.view = {
    defaultViewEngine: '.ejs',

    mapping: {
      '.html': 'ejs',
    },
  };
  config.session = {
    key: 'SESSION_ID',  // 设置session cookie里面的key
    maxAge: 1000*60*60*5, // 设置过期时间
    httpOnly: true,
    encrypt: true,
    // renew: true         // renew等于true 那么每次刷新页面的时候 session都会被延期
  }
  config.cluster = {
    listen: {
      path:'',
      port:80,
      hostname:'0.0.0.0',
    }
  }
  // add your middleware config here
  config.middleware = [];
 // 配置跨域
 config.cors = {
  origin: "*",	//允许所有跨域访问，注释掉则允许上面 白名单 访问
  allowMethods: 'GET,HEADER,PUT,POST,DELETE,PATCH',
  credentials: true	// 允许 Cookie 跨域（因情况而定）
}
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
